//SPU数据ts类型
import type { Trademark } from '@/api/product/trademark/type.ts'
export interface ResponseData {
  code: number
  message: string
  ok: boolean
}

export interface SpuResponseData extends ResponseData {
  data: {
    records: SpuList
    total: number
    size: number
    current: number
    pages: number
    searchCount: boolean
  }
}

export type SpuList = SpuInfo[]

export interface SpuInfo {
  id?: number | string
  spuName: string
  description: string
  category3Id: number | string
  tmId: number | string //品牌id
  spuSaleAttrList: null | SpuSaleAttr[] //spu销售属性
  spuImageList: null | SpuImage[]
}
//所有品牌数据
export interface AllTradeMark extends ResponseData {
  data: Trademark[]
}
//商品图片类型
export interface SpuImage {
  id?: number | string
  imgName: string
  imgUrl: string
  createTime?: string
  updateTime?: string
  spuId?: number | string
}
//获取SPU图片数据接口返回类型
export interface SpuImageResponseData extends ResponseData {
  data: SpuImage[]
}
//SPU销售属性类型
export interface SpuSaleAttr {
  id?: number | string
  createTime?: string
  updateTime?: string
  spuId?: number | string
  baseSaleAttrId: number | string
  saleAttrName: string
  spuSaleAttrValueList: SpuSaleAttrValue[]
  flag?: boolean
  saleAttrValue?: string
}
//SPU销售属性值类型
export interface SpuSaleAttrValue {
  id?: number | string
  createTime?: string
  updateTime?: string
  spuId?: number | string
  baseSaleAttrId: number | string
  saleAttrValueName: string
  saleAttrName?: string
  isChecked?: boolean
}
//获取SPU销售属性接口返回类型
export interface SpuSaleAttrResponseData extends ResponseData {
  data: SpuSaleAttr[]
}
//销售属性
export interface HasSaleAttr {
  id?: number | string
  name: string
}
//销售属性返回
export interface HasSaleAttrResponseData extends ResponseData {
  data: HasSaleAttr[]
}
export interface SkuResponseData extends ResponseData {
  data: SkuData[]
}
export interface SkuData {
  id?: number | string
  category3Id?: number | string
  spuId?: number | string
  tmId?: number | string
  skuName: string
  price: number | string
  weight: number | string
  skuDesc: string
  skuAttrValueList?: SkuAttr[]
  skuSaleAttrValueList?: SkuSaleAttr[]
  skuDefaultImg?: string
}
export interface SkuAttr {
  attrId: number | string
  valueId: string | number
}

export interface SkuSaleAttr {
  saleAttrId: number | string
  saleAttrValueId: string | number
}
